﻿Imports System.ComponentModel
Imports System.ComponentModel.DataAnnotations
Imports TodoMicroSolutionPackV1.dal.dto.ubicacion
Imports TodoMicroSolutionPackV1.dal.dto
Imports NHibernate
Imports NHibernate.Cfg
Imports NHibernate.Criterion

Namespace entidades.dal.dto
    Public Class entidad
        Private _id As Integer
        Private _razon_social As String
        Private _domicilio As String
        Private _localidad As localidad
        Private _tipo_documento As constante
        Private _numero_documento As Int64
        Private _posicion_iva As constante
        Private _email1 As String
        Private _email2 As String
        Private _email3 As String
        Private _telefono1 As String
        Private _telefono2 As String
        Private _telefono3 As String
        Private _nombre As String
        Private _apellido As String
        Private _tipo_entidad As constante
        <DisplayName("ID")>
        <Display(Order:=0, Name:="ID")>
        Public Overridable Property id As Integer
            Get
                Return _id
            End Get
            Set(ByVal value As Integer)
                _id = value
            End Set
        End Property
        <DisplayName("Razon Social")>
        <Display(Order:=1, Name:="Razon Social")>
        Public Overridable Property razon_social As String
            Get
                Return _razon_social
            End Get
            Set(ByVal value As String)
                _razon_social = value
            End Set
        End Property
        <DisplayName("Nombre")>
        <Display(Order:=2, Name:="Nombre")>
        Public Overridable Property nombre As String
            Get
                Return _nombre
            End Get
            Set(ByVal value As String)
                _nombre = value
            End Set
        End Property
        <DisplayName("Apellido")>
        <Display(Order:=3, Name:="Apellido")>
        Public Overridable Property apellido As String
            Get
                Return _apellido
            End Get
            Set(ByVal value As String)
                _apellido = value
            End Set
        End Property
        <Browsable(False)>
        <Display(AutoGenerateField:=False)>
        Public Overridable Property domicilio As String
            Get
                Return _domicilio
            End Get
            Set(ByVal value As String)
                _domicilio = value
            End Set
        End Property
        <Browsable(False)>
        <Display(AutoGenerateField:=False)>
        Public Overridable Property localidad As localidad
            Get
                Return _localidad
            End Get
            Set(ByVal value As localidad)
                _localidad = value
            End Set
        End Property
        <Browsable(False)>
        <Display(AutoGenerateField:=False)>
        Public Overridable Property tipo_documento As constante
            Get
                Return _tipo_documento
            End Get
            Set(ByVal value As constante)
                _tipo_documento = value
            End Set
        End Property
        Private ReadOnly Property tipoDocumentoConstantIsOK As Boolean
            Get
                Return _tipo_documento Is Nothing OrElse constantsUtil.isTipoDocumento(_tipo_documento)
            End Get
        End Property
        <DisplayName("Tipo de Documento")>
        <Display(Order:=4, Name:="Tipo de Documento")>
        Public Overridable ReadOnly Property tipo_documento_str As String
            Get
                Return _tipo_documento.valor
            End Get
        End Property
        <DisplayName("Numero de documento")>
        <Display(Order:=5, Name:="Numero de Documento")>
        Public Overridable Property numero_documento As Int64
            Get
                Return _numero_documento
            End Get
            Set(ByVal value As Int64)
                _numero_documento = value
            End Set
        End Property
        <Browsable(False)>
        <Display(AutoGenerateField:=False)>
        Public Overridable Property posicion_iva As constante
            Get
                Return _posicion_iva
            End Get
            Set(ByVal value As constante)
                _posicion_iva = value
            End Set
        End Property
        Private ReadOnly Property posicionIvaConstantIsOK As Boolean
            Get
                Return _posicion_iva Is Nothing OrElse constantsUtil.isPosicionIva(_posicion_iva)
            End Get
        End Property
        <DisplayName("E-Mail 1")>
        <Display(Order:=6, Name:="E-Mail 1")>
        Public Overridable Property email1 As String
            Get
                Return _email1
            End Get
            Set(ByVal value As String)
                _email1 = value
            End Set
        End Property
        <DisplayName("E-Mail 2")>
        <Display(Order:=7, Name:="E-Mail 2")>
        Public Overridable Property email2 As String
            Get
                Return _email2
            End Get
            Set(ByVal value As String)
                _email2 = value
            End Set
        End Property
        <DisplayName("E-Mail 3")>
        <Display(Order:=8, Name:="E-Mail 3")>
        Public Overridable Property email3 As String
            Get
                Return _email3
            End Get
            Set(ByVal value As String)
                _email3 = value
            End Set
        End Property
        <DisplayName("Tel 1")>
        <Display(Order:=9, Name:="Tel 1")>
        Public Overridable Property telefono1 As String
            Get
                Return _telefono1
            End Get
            Set(ByVal value As String)
                _telefono1 = value
            End Set
        End Property
        <DisplayName("Tel 2")>
        <Display(Order:=10, Name:="Tel 2")>
        Public Overridable Property telefono2 As String
            Get
                Return _telefono2
            End Get
            Set(ByVal value As String)
                _telefono2 = value
            End Set
        End Property
        <DisplayName("Tel 3")>
        <Display(Order:=11, Name:="Tel 3")>
        Public Overridable Property telefono3 As String
            Get
                Return _telefono3
            End Get
            Set(ByVal value As String)
                _telefono3 = value
            End Set
        End Property
        <Browsable(False)>
        <Display(AutoGenerateField:=False)>
        Public Overridable Property tipo_entidad As constante
            Get
                Return _tipo_entidad
            End Get
            Set(ByVal value As constante)
                _tipo_entidad = value
            End Set
        End Property
        Private ReadOnly Property tipoEntidadConstantIsOK As Boolean
            Get
                Return _tipo_entidad Is Nothing OrElse constantsUtil.isTipoEntidad(_tipo_entidad)
            End Get
        End Property
        Public Overridable Function esCliente() As Boolean
            Return (_tipo_entidad.codigo = "01" Or _tipo_entidad.codigo = "11")
        End Function
        Public Overridable Function esProveedor() As Boolean
            Return (_tipo_entidad.codigo = "10" Or _tipo_entidad.codigo = "11")
        End Function

        Public Overridable Function esResponsableIscripto() As Boolean
            Return _posicion_iva.codigo = "1"
        End Function
        Public Overridable Function esMonotributista() As Boolean
            Return _posicion_iva.codigo = "2"
        End Function
        Public Overridable Function esExcento() As Boolean
            Return _posicion_iva.codigo = "3"
        End Function
        Public Overridable Function esCosumidorFinal() As Boolean
            Return _posicion_iva.codigo = "4"
        End Function
    End Class
End Namespace
